<template>
  <div class="com-card-box">
    <header>
      <span>{{ title }}</span>
      <slot name="func" />
    </header>
    <main class="main">
      <div :style="height && {'min-height': height}">
        <slot></slot>
      </div>
    </main>
    <slot name="footer"></slot>
  </div>
</template>

<script>
export default {
  props: {
    title: {
      type: String,
      required: true
    },
    height: {
      type: [Number, String],
      default: 0
    }
  }
};
</script>

<style lang="scss" scoped>
.com-card-box {
  box-shadow: 0px 3px 12px 0px rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}
header {
  height: 36px;
  background-color: #f9f9f9;
  font-size: 16px;
  color: #333;
  line-height: 36px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
main {
  min-height: 50px;
  max-height: 80vh;
  overflow-x: auto;
  padding: 20px 30px;
}
</style>
